package flc.ast.adapter;

import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import com.youth.banner.adapter.BannerAdapter;
import com.youth.banner.util.BannerUtils;

import java.util.List;

import flc.ast.R;

public class MyBannerAdapter extends BannerAdapter<Integer, MyBannerAdapter.ImageTitleHolder> {


    public MyBannerAdapter(List<Integer> datas) {
        super(datas);
    }

    @Override
    public ImageTitleHolder onCreateHolder(ViewGroup parent, int viewType) {
        return new ImageTitleHolder(BannerUtils.getView(parent, R.layout.item_banner));
    }

    @Override
    public void onBindView(ImageTitleHolder holder, Integer data, int position, int size) {
        holder.imageView.setImageResource(data);
    }

    public class ImageTitleHolder extends RecyclerView.ViewHolder {
        public ImageView imageView;

        public ImageTitleHolder(@NonNull View view) {
            super(view);
            imageView = view.findViewById(R.id.ivBannerItemImg);
        }
    }
}
